#include <iostream>
#include <vector>

using namespace std;

const vector<int>* generate_vec(int number)
{
    static vector<int> vec;
    int max_size = 10000;

    if (number > max_size)
    {
        cout << "Overflow !";
        return 0;
    }

    for (int ix = 0; ix < number; ix++)
        vec.push_back((ix + 1) * (3 * ix + 2) / 2);

    return &vec;
}

void print_vec(int number, const string & title)
{
    const vector<int> *vec = generate_vec(number);
    if (!vec)
        return;

    cout << title << endl;

    for (int ix = 0; ix < (int)(*vec).size(); ix++)
        cout << (*vec)[ix] << " ";
    cout << endl;
}

int main()
{
    int size;

    cout << "Please enter the series length: ";
    cin >> size;
    const string title = "Numberic Series";

    print_vec(size, title);

    return 0;
}